AS Algorithm 2